home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4249 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.6 KB  |  81 lines

  1. Path: Austria.EU.net!pctpg7
  2. From: paumann@apars1.apa.co.at (Mario Paumann)
  3. Newsgroups: comp.sys.hp.hpux,comp.lang.c++,de.comp.lang.c++
  4. Subject: HP-UX 10.01 C++ : Bug in fstream Library ?
  5. Date: Mon, 29 Jan 96 15:39:13 GMT
  6. Organization: APA - Austrian Press Agency
  7. Message-ID: <4ei4hd$6ov@news.Austria.EU.net>
  8. NNTP-Posting-Host: pctpg7.apa.co.at
  9. X-Newsreader: News Xpress Version 1.0 Beta #3
  10.  
  11. Hi !
  12.  
  13. Have someone recognized a problem
  14. with files in input and output mode
  15. when reading to the end of the file
  16. and then want to write something to
  17. the file ?
  18.  
  19. Try the following (command line) with the
  20. Example (see end of posting) compiled to a.out :
  21.  
  22. $ echo test >dingsda
  23. $ a.out
  24. $ wc -l dingsda
  25. $ cat dingsda
  26.  
  27. ok. dingsda got 40 lines with the same string
  28. in it ("1234567890_12\n").
  29. But then try this.
  30.  
  31. $ rm dingsda
  32. $ a.out
  33. $ wc -l dingsda
  34. $ cat dingsda
  35.  
  36. you will get _one line_ with the above string
  37. in it !?!?
  38.  
  39. When shortening the above string with one
  40. character to "1234567890_1\n" both command
  41. line examples above will work like expected 
  42. (40 lines are generated) !
  43.  
  44.  
  45. Someone ever hit this bug ?
  46. Maybe there is a patch ?
  47. Please help !
  48.  
  49. Thanx, mario
  50.  
  51.  
  52.  
  53. a.out source :
  54. --------------
  55.  
  56. #include <iostream.h>
  57.  
  58. main()
  59.  
  60. { fstream mylog;
  61.   char i[1024];
  62.  
  63.   mylog.open("dingsda", ios::in | ios::out);
  64.  
  65.   // Reading
  66.   mylog >> i;
  67.  
  68.   // Writing
  69.   // !!!!! Take care about the length of the string !!!!!!
  70.   for (int j=0; j<40; j++)
  71.     mylog << "1234567890_12\n;
  72.  
  73.   return 0;
  74. }
  75.  
  76. --------------------------------------
  77. Fuer de.comp.lang.c++ Zuschauer :
  78. Tut mir leid, dass ich englisch geschrieben
  79. habe, aber ich wollte es auch in englische
  80. newsgroups posten. Danke !
  81.